package com.actionpals.webapis.gdata
{
	import com.adobe.xml.syndication.Namespaces;
	import com.adobe.xml.syndication.NewsParser;
	import com.adobe.xml.syndication.ParsingTools;
	import com.adobe.xml.syndication.atom.IAtom;
	import com.adobe.xml.syndication.atom.IFeedData;

	public class GData extends NewsParser implements IAtom
	{
		private var atom:Namespace = Namespaces.ATOM_NS;
		private var kind:String = "http://schemas.google.com/g/2005#kind";
		private var _feedData:FeedData;
		private var _entries:Array;
		private var _kinds:IKinds;

		/**
		 *	Constructor for class.
		 */	
		public function GData( kinds:IKinds )
		{
			_kinds = kinds;
			super();
		}

		/**
		 *	The FeedData object associated with the feed. 
		 *
		 *	This contains metadata and other data associated with the feed.
		 */	
		public function get feedData():IFeedData
		{
			if ( this._feedData == null )
			{
				this._feedData = new FeedData( XMLList( this.x ) );
			}
			
			return this._feedData;
		}

		/**
		 *	An Array of Entry classes that represent all of the entry elements within
		 *	the feed.
		 */	
		public function get entries():Array
		{
			var catagories:Array = this._feedData.categories;
			var EntryKind:Class;
			var j:XML;
			
			if ( ParsingTools.nullCheck( this.x.atom::entry ) == null ) return null
			if ( this._entries == null )
			{
				for( var i:int = 0; i< catagories.length; i++ )
				{
					
				}
				
				this._entries = new Array();
				
				for each ( j in this.x.atom::entry )
				{
					this._entries.push( new EntryKind( XMLList( j ) ) );
				}
			}
			
			return this._entries;
		}
	}
}